# -*- coding: utf-8 -*-
from django import forms
from wikicamp.documentation.models import *
from django.forms import ModelForm
from django.contrib.auth.models import Group
import datetime

class DocumentForm(ModelForm):
    caption = forms.CharField(widget=forms.widgets.Textarea(attrs={'cols':50,'rows':3}),max_length=250,label=u'Belge Açıklamaları ')
    
    class Meta:
        model = Document
        exclude = ('created_on')
   
    def save(self, commit=True):
        m = super(DocumentForm, self).save(commit=False)
        m.created_on = datetime.datetime.now()
        if commit:
            m.save()
        return m

 
class CategoriesForm(ModelForm):
    parent_id = forms.ModelChoiceField(queryset=Categories.objects.all(),label='Kategori ')
    class Meta:
        model = Categories
        exclude = ('grup')

class TagForm(ModelForm):
    class Meta:
        model = Tag
        
class GroupForm(ModelForm):
    class Meta:
        model= Group
        
class SearchForm(forms.Form):
    text = forms.CharField(label=u"Arama Kriterini Giriniz :")
   
  
